import { IsEnum, IsNotEmpty, IsNumber, IsOptional, MaxLength } from 'class-validator'
import i18n, { i18nMessage } from '@/i18n'
import { DomainModel } from '@apps/meta/domain/model'
import { ApiProperty } from '@nestjs/swagger'

export class MetaFileSaveDto {
  @ApiProperty({ description: i18n.t('app-meta.dto.meta-file-save.12152185-0') })
  @MaxLength(64, { message: i18nMessage() })
  @IsNotEmpty()
  label: string

  @ApiProperty({ description: i18n.t('app-meta.dto.meta-file-save.12152185-1'), type: String })
  @MaxLength(256, { message: i18nMessage() })
  @IsNotEmpty()
  url: string

  @ApiProperty({
    description: i18n.t('app-meta.dto.meta-file-save.12152185-2'),
    enum: DomainModel.ApiPropertyEnum.MetaFileType,
  })
  @IsNotEmpty()
  @IsEnum(DomainModel.MetaFileType)
  type: DomainModel.MetaFileType

  @ApiProperty({ description: i18n.t('app-meta.dto.meta-file-save.12152185-3') })
  @IsNotEmpty()
  @MaxLength(64, { message: i18nMessage() })
  platform: string

  @ApiProperty({ description: i18n.t('app-meta.dto.meta-file-save.12152185-4') })
  @MaxLength(64, { message: i18nMessage() })
  @IsOptional()
  project?: string

  @ApiProperty({ description: i18n.t('app-meta.dto.meta-file-save.12152185-5') })
  @IsNotEmpty()
  @MaxLength(64, { message: i18nMessage() })
  groupLabel: string

  @ApiProperty({ description: i18n.t('app-meta.dto.meta-file-save.12152185-6') })
  @IsNumber()
  @IsOptional()
  sortNo?: number
}
